package com.shanling.shanlingcontroller.persenter

import com.shanling.shanlingcontroller.bean.Album
import com.shanling.shanlingcontroller.bean.Artist
import com.shanling.shanlingcontroller.music.player.SongLoader
import com.shanling.shanlingcontroller.persenter.contract.PlayListDetailContract
import org.jetbrains.anko.doAsync
import org.jetbrains.anko.uiThread

/**
 * Created by ch1 on 2019/11/22.
 */
class  PlayListDetailPersenter
constructor() : RxPresenter<PlayListDetailContract.View>(), PlayListDetailContract.Presenter
{
    override fun loadSongsForArtist(artist: Artist?) {
            doAsync {
                val data = SongLoader.getSongsForArtist(artist!!.name)
                uiThread {
                    mView.showSongs(data)
                }
            }
    }

    override fun loafSongsForAlbum(album: Album?) {
        doAsync {
            val data = SongLoader.getSongsForAlbum(album!!.name)
            uiThread {
                mView.showSongs(data)
            }
        }
}
}